#import "PlayerView.h"
#import "PlayView.h"


@implementation PlayerView

-(IBAction) Playbtn_Clicked:(id)play{
	NSString *serverIP = aServerIP.ServerIP;
	NSString *server = [[NSString alloc] initWithFormat:@"http://%@:41402/request.html?action=execute",serverIP];
	//create the request
	NSURL *url = [NSURL URLWithString:server];
	NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
	
	[request setHTTPMethod:@"GET"];
	[request setCachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData];
	NSURLConnection *connection = [[NSURLConnection alloc]
								   initWithRequest:request	
								   delegate:self];
	NSLog(server, connection);
	commandText.text = @"Play Command Sent";
}


-(IBAction) stopbtn_Clicked:(id)stop
{
		NSString *serverIP = aServerIP.ServerIP;
		NSString *server = [[NSString alloc] initWithFormat:@"http://%@:41402/request.html?action=stop",serverIP];
		//create the request
		NSURL *url = [NSURL URLWithString:server];
		NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
		
		[request setHTTPMethod:@"GET"];
		[request setCachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData];
		NSURLConnection *connection = [[NSURLConnection alloc]
									   initWithRequest:request	
									   delegate:self];
		NSLog(server, connection);
		commandText.text = @"Stop Command Sent";
		
	}


-(IBAction) Pausebtn_Clicked:(id)pause
{
	NSString *serverIP = aServerIP.ServerIP;
	NSString *server = [[NSString alloc] initWithFormat:@"http://%@:41402/request.html?action=pause",serverIP];
	//create the request
	NSURL *url = [NSURL URLWithString:server];
	NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
	
	[request setHTTPMethod:@"GET"];
	[request setCachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData];
	NSURLConnection *connection = [[NSURLConnection alloc]
								   initWithRequest:request	
								   delegate:self];
	NSLog(server, connection);
	commandText.text = @"Pause Command Sent";
}


-(void)dealloc{
	[super dealloc];
}




- (void)viewDidLoad {
    [super viewDidLoad];
	self.title = @"Player";
}


- (void)viewWillAppear:(BOOL)animated {
	[super viewWillAppear:animated];

}
@end
